<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="description" content="Clanpage using webSPELL 4 CMS" />
<meta name="author" content="webspell.org" />
<meta name="keywords" content="webspell, webspell4, clan, cms" />
<meta name="copyright" content="Copyright &copy; 2005 - 2009 by webspell.org" />
<meta name="generator" content="webSPELL" />

<!-- Head & Title include -->
<title>News</title>
<link href="_stylesheet.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="js/ckeditor/adapters/jquery.js"></script>

<script src="js/bbcode.js" type="text/javascript"></script>
<!-- end Head & Title include -->
<script type="text/javascript">
<!-- 

CKEDITOR.config.contentsCss = '_stylesheet.css';
CKEDITOR.config.width = $picsize_l;
CKEDITOR.config.filebrowserBrowseUrl = 'upload.php?newsID=$newsID';
CKEDITOR.config.filebrowserUploadUrl = 'upload.php?newsID=$newsID';
CKEDITOR.config.filebrowserWindowWidth = 800;
CKEDITOR.config.filebrowserWindowHeight = 600;

default_language = "de";

message = new Array();
headline = new Array();
langs = new Array();

news_languages = new Array();
$langs

function update_language() {
	delete_array = new Array();
	for(var i = 0; i < news_languages.length; i++) {
		delete_array[i] = new Array(0, null);
	}
	for(var i = 0; i < langs.length; i++) {
		option = document.getElementById('lang_' + i);
		for(var z = 0; z < news_languages.length; z++) {
			if(option.options[z].selected == true) {
				delete_array[z][0] = 1;
				delete_array[z][1] = i;
			}
		}
	}
	for(var i = 0; i < langs.length; i++) {
		option = document.getElementById('lang_' + i);
		for(var z = 0; z < news_languages.length; z++) {
			if(delete_array[z][0] == 1 && delete_array[z][1] != i) {
				option.options[z].disabled = true;
				option.options[z].style.backgroundColor = '#B10000';
				option.options[z].style.display = 'none';
			}
			else {
				option.options[z].disabled = false;
				option.options[z].style.backgroundColor = '#FFFFFF';
				option.options[z].style.display = '';
			}
		}
	}
}

function initialize_language() {
	delete_array = new Array();
	for(var i = 0; i < news_languages.length; i++) {
		delete_array[i] = 0;
	}
	for(var i = 0; i < langs.length; i++) {
		option = document.getElementById('lang_' + i);
		for(var z = 0; z < news_languages.length; z++) {
			new_option = new Option(news_languages[z][1], news_languages[z][0], false, false);
			option.options[z] = new_option;
			if(langs[i] != '') {
				if(langs[i] == news_languages[z][0]) {
					option.options[z].selected = true;
					delete_array[z] = 1;
				}
			}
			else if(i == 0 && news_languages[z][0] == default_language) {
				option.options[z].selected = true;
				delete_array[z] = 1;
				langs[i] = news_languages[z][0];
			}
			else if(i != 0 && delete_array[z] == 0) {
				option.options[z].selected = true;
				delete_array[z] = 1;
				langs[i] = news_languages[z][0];
			}
		}
	}
}
function update_textarea(value) {
	$("#news_textarea textarea").each(function(index) {
		message[index] = $(this).val();
		var editor = $(this).ckeditorGet();
		if (editor) {
			editor.destroy()
		}
	});
	document.getElementById('news_textarea').innerHTML='';
	for(var i = 0; i < value; i++) {
		if(message[i] || headline[i] || langs[i] && langs[i] != default_language)
		{
			document.getElementById('news_textarea').innerHTML+='<select name="lang[]" id="lang_' + i + '" onchange="langs['+i+']=this.value; update_language();"></select>';
			document.getElementById('news_textarea').innerHTML+=' %headline% <input name="headline[]" type="text" value="'+headline[i]+'" size="80" onchange="headline['+i+']=this.value;" />';
			document.getElementById('news_textarea').innerHTML+='<textarea name="message[' + i + ']" rows="20">'+message[i]+'</textarea><br /><br />';
		}
		else
		{
			message[i] = '';
			headline[i] = '';
			langs[i] = '';
			document.getElementById('news_textarea').innerHTML+='<select name="lang[]" id="lang_' + i + '" onchange="langs['+i+']=this.value; update_language();"></select>';
			document.getElementById('news_textarea').innerHTML+=' %headline% <input name="headline[]" type="text" value="" size="80" onchange="headline['+i+']=this.value;" />';
			document.getElementById('news_textarea').innerHTML+='<textarea name="message[' + i + ']" rows="20"></textarea><br /><br />';
		}
	}
	$("#news_textarea textarea").ckeditor();
	if(message.length > value) {
		var message_length = message.length;
		for(var i = value; i < message_length; i++) {
			delete message[i];
			message.length--;
			delete headline[i];
			headline.length--;
			delete langs[i];
			langs.length--;
		}
	}
	
	initialize_language();
	update_language();
}

function chkFormular() {
	
	if(document.getElementsByName('headline[]')[0].value == "") {
		alert("%enter_title%");
		document.getElementsByName('headline[]')[0].focus();
   		return false;
	}
	
}

$message_vars
$headline_vars
$langs_vars

$(document).ready(function() {
	update_textarea($langcount);
});
-->
</script>
<style type="text/css">
	body {margin: 0px;}
</style>
</head>
<body>
<form action="news.php?action=save" method="post" enctype="multipart/form-data" id="post" name="post" onsubmit="return chkFormular();">
<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="$border">
  <tr>
    <td class="title" align="center" bgcolor="$bghead">%new_post%</td>
  </tr>
  <tr><td bgcolor="$pagebg"></td></tr>
  <tr>
    <td bgcolor="$bg1">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td valign="top">$addbbcode</td>
        <td valign="top">$addflags</td>
      </tr>
    </table>
    <hr />
    <table width="100%" border="0" cellspacing="0" cellpadding="2">
      <tr>
        <td><b>%rubric%:</b> <select name="rubric">$rubrics</select>
        &nbsp;&nbsp;&nbsp; <small><b>%options%:</b> &#8226; %html%</small></td>
      </tr>
      <tr>
        <td><hr /></td>
      </tr>
      <tr>
        <td>
        <table width="100%" border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td><b>%options%</b></td>
            <td><b>%languages%:</b></td>
          </tr>
          <tr>
            <td><i>%topnews%:</i>&nbsp;&nbsp;<select name="topnews">$topnews</select>
            <i>%intern%:</i>&nbsp;&nbsp;<select name="intern">$intern</select></td>
            <td>%post_languages%</td>
          </tr>
        </table>
        </td>
      </tr>
      <tr>
        <td><hr /></td>
      </tr>
    </table>
    <div id="news_textarea"></div>
    <hr />
    <table width="100%" border="0" cellpadding="0" cellspacing="2">
      <tr>
        <td valign="top">%link% 1:
        <input name="link1" type="text" value="$link1" />
        <input name="url1" type="text" value="$url1" />
        <input class="input" name="window1" type="radio" value="1" $window1_new />
        %new_window%
        <input class="input" type="radio" name="window1" value="0" $window1_self/>
        %self%
        <br />
        %link% 2:
        <input name="link2" type="text" value="$link2" />
        <input name="url2" type="text" value="$url2" />
        <input class="input" name="window2" type="radio" value="1" $window2_new/>
        %new_window%
        <input class="input" type="radio" name="window2" value="0" $window2_self />
        %self%
        <br />
        %link% 3:
        <input name="link3" type="text" value="$link3" />
        <input name="url3" type="text" value="$url3" />
        <input class="input" name="window3" type="radio" value="1" $window3_new/>
        %new_window%
        <input class="input" type="radio" name="window3" value="0" $window3_self />
        %self%
        <br />
        %link% 4:
        <input name="link4" type="text" value="$link4" />
        <input name="url4" type="text" value="$url4" />
        <input class="input" name="window4" type="radio" value="1" $window4_new/>
        %new_window%
        <input class="input" type="radio" name="window4" value="0" $window4_self />
        %self%</td>
        <td valign="top"><br />&nbsp;</td>
      </tr>
      <tr>
        <td colspan="5"><hr /></td>
      </tr>
      <tr align="right">
        <td colspan="2">
        <input type="hidden" name="userID" value="$userID" />
        <input type="hidden" name="newsID" value="$newsID" />
        <select name="comments">$comments</select>
        <input type="submit" name="preview" value="%preview%" />
        <input type="submit" name="save" value="%save_news%" />
        <input type="button" onclick="window.close()" value="%cancel%" /></td>
      </tr>
    </table>
    </td>
  </tr>
</table>
</form>
</body>
</html>